;(function () {

    // echarts第一步
    const chartWrapper = document.querySelector('.channel-wrapper .chart');
     // 生成echarts实例
    const chart = echarts.init(chartWrapper);
    
    // echarts第二步
    // 写option配置项
    const option = {
        tooltip: {
            show: true,
            backgroundColor: 'rgba(0, 0, 0, .5)',
            borderWidth: 0,
            textStyle: {
                color: '#ffffff',
            },
        },
        radar: [
            {
                indicator: channel,
                center: ['50%', '50%'],
                radius: 50,
                startAngle: 90,
                splitNumber: 4,
                shape: 'circle',
                name: {
                    textStyle: {
                        color: '#428BD4'
                    },
                },
                // 向外延伸的线
                axisLine: {
                    lineStyle: {
                        color: 'rgba(255, 255, 255, .3)',
                    },
                },
                // 圆
                splitLine: {
                    lineStyle: {
                        color: 'rgba(255, 255, 255, .3)',
                    },
                },
            },
        ],
        series: [
            {
                type: 'radar',
                emphasis: {
                    lineStyle: {
                        width: 4,
                    }
                },
                areaStyle: {
                    opacity: .5,
                },
                label: {
                    show: true,
                    color: 'white',
                },
                data: [
                    {
                        value: channel.map(function (item) {
                            return item.value;
                        }),
                    },
                ],
            },
        ],
    };
    
    // echarts第三步
    // 导入配置项
    chart.setOption(option);
    
})();